/*
 * Description: This class reads and gives format to the excel file
 * as color, font weight, font size
 */

package exampleseverything.poi_jxls;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import exampleseverything.utils.Styles;
import exampleseverything.utils.ConstantsExEv;
/**
 *
 * @author HellCoders
 */
public class FormatterXl implements ConstantsExEv{

    public static Workbook readExcelFile(String file)throws IOException {
        FileInputStream fim = new FileInputStream(file);
        Workbook wb = new HSSFWorkbook(fim);
        return wb;
    }

    public static void formatReport()throws IOException {
        //TODO call the Styles methods to format the report
        Workbook wb = readExcelFile(ConstantsExEv.OUTPUT_EX_ONE);
        Sheet  sheet = wb.getSheetAt(0);
        Cell cell = sheet.getRow(0).getCell(0);
        System.out.println(cell.getStringCellValue());
        cell.setCellStyle(Styles.titleHeader(wb));
        FileOutputStream fos = new FileOutputStream(ConstantsExEv.OUTPUT_EX_ONE);
        wb.write(fos);
    }
}
